<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>管理员操作日志</title>
    <link rel="stylesheet" type="text/css" href="/static/hplus/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/static/hplus/css/style.css">
    <link rel="stylesheet" type="text/css" href="/static/layer/skin/layer.css">
    <style type="text/css">
        .form-control {width: 220px;}
        .ttd {width: 250px;text-align: center;}
        .ttb {width: 80px;text-align: center;}
    </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <form action="/admin/logs" method="get">
                        <table style="width: 100%;padding: 0;border: none">
                            <tr>
                                <td class="ttd">
                                    <input type="text" name="keyword" placeholder="账号" class="input-sm form-control" value="{$param.keyword}">
                                </td>
                                <td class="ttb"><input type="submit" class="btn btn-sm btn-primary" value="搜索"></td>
                                <td>&nbsp;</td>
                            </tr>
                        </table>
                    </form>
                </div>
                <div class="ibox-content">
                    <table id="treeTable"></table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" src="/static/hplus/js/jquery.min.js?v={php}echo time(){/php}"></script>
<script type="text/javascript" src="/static/layer/layer.js?v={php}echo time(){/php}"></script>
<script type="text/javascript" src="/static/royui/royui.min.js?v={php}echo time(){/php}"></script>
<script type="text/javascript">
    $(function () {
        //let $data = JSON.parse('<?php echo json_encode($list);?>');
        let r = new royui();
        r.treeTable({
            elem: '#treeTable',
            //data: $data,
            url: '/admin/logs',
            paging: true,
            first_page: true,
            prev_page: true,
            next_page: true,
            count: {$count},
            pages: {$pages},
            show_pages: 9,
            total_page: true,
            jump_to: true,
            cols: [
                {
                    field: 'username',
                    title: '账号'
                },
                {
                    title: '日志内容',
                    template: function ($item) {
                        if ($item.tip !== '') {
                            return '<a title="' + $item.tip + '" style="color: #000">' + $item.log + '</a>'
                        } else {
                            return $item.log
                        }
                    }
                },
                {
                    field: 'data',
                    title: '参数',
                    style: 'word-break: break-all;max-width: 800px',
                    title_style: 'max-width: 800px'
                },
                {
                    field: 'ctime',
                    title: '操作时间'
                },
                {
                    field: 'login_time',
                    title: '登录时间',
                    title_style: 'cursor: pointer',
                    is_sort: true
                },
                {
                    field: 'login_ip',
                    title: '登录IP'
                }
            ]
        })
    });
</script>
</html>
